package src.main.StructuralPatterns.Flyweight;

public class Client {
    public static void main(String[] args) {
        // 订单列表
        CoffeeOrderContext[] orders = {
                new CoffeeOrderContext(1, "Jack"),
                new CoffeeOrderContext(2, "Jill"),
                new CoffeeOrderContext(3, "Tom"),
        };

        // 获取共享的咖啡风味
        CoffeeFlavor cappuccino = CoffeeFactory.getCoffeeFlavor("Cappuccino");
        CoffeeFlavor latte = CoffeeFactory.getCoffeeFlavor("Latte");

        // 处理订单
        cappuccino.serveCoffee(orders[0]);
        latte.serveCoffee(orders[1]);
        cappuccino.serveCoffee(orders[2]);

        System.out.println("Coffee size:" + CoffeeFactory.gerTotalFlavor());
    }
}
